home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / man / oldman3 / Iterator.3T < prev    next >
Text File  |  1992-06-26  |  3KB  |  92 lines

  1. .TH ITERATOR
  2. .SH NAME
  3. Iterator<Type>\f1  A parameterized iterator class
  4. .SH SYNOPSIS
  5. #include <cool/Iterator.h>
  6. .SH DESCRIPTION
  7. The
  8. \f3Iterator<Type>\f1 class provides an independent mechanism for
  9. maintaining the state associated with the current position of an
  10. instance of a container class.  In this manner, multiple iterators over
  11. the same instance of a class can be supported.  Each container class
  12. that supports the current position notion has some data structure that
  13. is used to represent the state. This may be as simple as a type long, or
  14. something more involved as with a union of of bit fields or even another
  15. class instance.  In addition, each container class has a method to
  16. get/set the current position. Utilization of this method with the
  17. Iterator storage will facilitate storage and retrieval of the current
  18. position.
  19. .PP
  20. The container-specific data structure used to hold the current position
  21. state in all cool container classes will -- by convention -- be named
  22.  Class_state, 
  23. where 
  24.  Class
  25. is the name of the container class header file.  Thus, a user who
  26. includes Vector.h will declare an
  27.  Iterator<Vector>,
  28. and the internal data structure that maintains the state will be of type
  29.  Vector_state.
  30. In this manner, the \f3Iterator<Type>\f1 class can be parameterized
  31. over the container class name (ie.  
  32.  Bit_Set, Vector,
  33. etc.)  and allocate
  34. a data slot of the appropriate type by concatenating the
  35.  Type
  36. name with
  37. the string 
  38.  "_state"
  39. all without the user having to know anything about
  40. internal implementation details.
  41. .PP
  42. Each container class has a public method that returns a reference to
  43. this iterator state data structure.  The six methods that support
  44. current position functionality in all of the container classes always
  45. work on the current position as maintained in the private data section.
  46. A user can, at any point, change the current position state information
  47. by utilizing this method to get and/or set the current position.  One
  48. final note: each state data structure implemented in every container
  49. class must support the assignment of
  50.  INVALID
  51. in some manner such that a state with this value (defined in
  52. <cool/misc.h>) will cause an exception if used before set.
  53.  
  54. .SH Base Classes
  55. None
  56. .SH Friend Classes
  57. None
  58. .SH Constructors
  59. .TP
  60. \f3Iterator<Type> ();\f1
  61. Simple constructor that initializes the  container.
  62. .TP
  63. \f3inline Iterator<Type> (Type_state&);\f1
  64. Constructor that takes a reference to the container's current position
  65. state,
  66.  Type_state,
  67. and copies the value to the internal slot.  This is utilized when
  68. calling the current_position() method of some container class.
  69. .SH Member Functions
  70. \f3inline operator long();\f1
  71. Overloaded operator to convert from the current position state to a
  72. long. This is required by all classes except the 
  73.  List
  74. and
  75.  Tree
  76. classes.
  77. .SH Friend Functions
  78. .TP
  79. None
  80. .SH COPYRIGHT
  81.  
  82. Copyright (C) 1991 Texas Instruments Incorporated.
  83.  
  84. Permission is granted to any individual or institution to use, copy, modify,
  85. and distribute this software, provided that this complete copyright and
  86. permission notice is maintained, intact, in all copies and supporting
  87. documentation.
  88.  
  89. Texas Instruments Incorporated provides this software "as is" without
  90. express or implied warranty.
  91.  
  92.